package com.joesem.sale.client.widget.dialog

import android.os.Bundle
import androidx.fragment.app.FragmentManager
import com.blankj.utilcode.util.ConvertUtils
import com.igexin.sdk.PushManager
import com.jiaxing.sale.client.databinding.DialogNoticePermissionBinding
import com.joesem.sale.client.base.BaseBottomFragmentDialog
import com.joesem.sale.client.utils.click

class NoticePermissionDialog : BaseBottomFragmentDialog<DialogNoticePermissionBinding>() {
    override fun contentMax(): Int {
        return ConvertUtils.dp2px(370f)
    }

    override fun DialogNoticePermissionBinding.initView(savedInstanceState: Bundle?) {

    }

    override fun DialogNoticePermissionBinding.initListener() {
        ivClose.click {
            dismiss()
        }
        btnOpen.click {
            PushManager.getInstance().apply {
                openNotification(requireContext())
            }
            dismiss()
        }
    }
}

fun optionNoticePermission(fm: FragmentManager) {
    NoticePermissionDialog().show(fm, null)
}